package leetcode.code1893;

import java.util.Arrays;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

public class Solution implements IDebug {

	public boolean isCovered(int[][] ranges, int left, int right) {
		Arrays.sort(ranges, (a, b) -> a[0] - b[0]);
		int l = 0, r = 0;
		for (int[] range : ranges) {
			if ((l = range[0]) <= left && left <= (r = range[1])) {
				left = range[1] + 1;
				if (l <= right && right <= r) {
					return true;
				}
			}
		}
		return false;
	}

	@Override
	public void debug1() {
		HelpDebug.compare(false, this.isCovered(HelpDebug.str2array1("[[1,2],[6,6],[3,4]]"), 2, 6));

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();

	}

}
